package com.peng.mapper;

import com.peng.pojo.User;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;
//就是在原本基础上新继承了一个SqlSessionDaoSupport类，
//这个类里边直接写了一个setSqlSessionFactory方法获得SqlSessionFactory
//然后在配置文件中去注入sqlSessionFactory即可
public class UserMapperImp2 extends SqlSessionDaoSupport implements UserMapper {
    public List<User> selectUser() {
        SqlSession sqlSession = getSqlSession();
        UserMapper mapper = sqlSession.getMapper(UserMapper.class);
        return mapper.selectUser();
    }
}
